import drawQrcode from '../../utils/weapp.qrcode.esm.js'

const app = getApp()
Page({

  data: {
    userInfo: {},
    bgcolor: "green"
  },

  onLoad: function () {
    this.setData({
      userInfo: wx.getStorageSync('userInfo')
    })
    if(this.data.userInfo.status===2){
      this.setData({
        bgcolor: "red"
      })
    }else if (this.data.userInfo.status===1) {
      this.setData({
        bgcolor: "yellow"
      })
    }
    drawQrcode({
      width: 200,
      height: 200,
      canvasId: 'myQrcode',
      text: wx.getStorageSync('userInfo').openid,
      // v1.0.0+版本支持在二维码上绘制图片
      image: {
        imageResource: '../../images/WXP.png',
        dx: 70,
        dy: 70,
        dWidth: 60,
        dHeight: 60
      }
    })

  },
  toPersionalCenter() {
    wx.navigateTo({
      url: '/pages/persional-center/persional-center',
    })
  },
  toHealthMsg() {
    wx.navigateTo({
      url: '/pages/health-msg/health-msg',
    })
  }

})